import global from './../global'
cc.Class({
    extends: cc.Component,

    properties: {

    },

    start () {
        //global.socket.init();

        global.eventListener.on('test', (data)=>{
            console.log('test success' + data);
        });
        global.eventListener.fire('test', 'ok');
    },

    onButtonClick:function(event,customData){
        global.socket.requestLogin({
            'uniqueID':global.playerData.uniqueID,
            'accountID':global.playerData.accountID,
            'nickName':global.playerData.nickName,
            'avatarUrl':global.playerData.avatarUrl,
        },function(err,data){
            if(err){
                console.log('err');
            }else{
                console.log(data.goldCount);
                global.playerData.goldCount = data.goldCount;
                cc.director.loadScene('hall');
            }
        });
    },
});
